#include <iostream>
#include <string>
#include <queue>
#include <stack>
using namespace std;

void p1(const queue<char>& _q) {
	auto q = _q;
	int len = q.size();
	if (q.back() == '-') {
		len--;
		cout << '-';
	}
	stack<char> ans;
	for (int i = 0; i < len; i++) {
		ans.push(q.front()); q.pop();
		if (i % 4 == 3 && i != len - 1)
			ans.push(',');
	}
	while (ans.size()) {
		cout << ans.top(); ans.pop();
	}
}
#include <algorithm>
queue<char> p2(string& n1, string& n2) {
	if (n1.size() < n2.size()) return p2(n2, n1);
	reverse(n1.begin(), n1.end());
	reverse(n2.begin(), n2.end());
	vector<int> A, B;
	for (auto c : n1) A.push_back(c - '0');
	for (auto c : n2) B.push_back(c - '0');
	//cout << "p2:\n";
	//for (auto e : A) cout << e << ' '; cout << endl;
	//for (auto e : B) cout << e << ' '; cout << endl;
	vector<int> C;
	int t = 0;
	for (int i = 0; i < A.size(); i++)
	{
		t += A[i];
		if (i < B.size()) t += B[i];
		C.push_back(t % 10);
		t /= 10;
	}
	if (t) C.push_back(t);
	queue<char> ret;
	for (auto e : C) ret.push(e + '0');
	return ret;
}
queue<char> p3(string& n1, string& n2) {
	reverse(n1.begin(), n1.end());
	reverse(n2.begin(), n2.end());
	vector<int> A, B;
	for (auto c : n1) A.push_back(c - '0');
	for (auto c : n2) B.push_back(c - '0');
	//cout << "p3:\n";
	//for (auto e : A) cout << e << ' '; cout << endl;
	//for (auto e : B) cout << e << ' '; cout << endl;
	vector<int> C;
	for (int i = 0, t = 0; i < A.size(); i++)
	{
		t = A[i] - t;
		if (i < B.size()) t -= B[i];
		C.push_back((t + 10) % 10);
		if (t < 0) t = 1;
		else t = 0;
	}
	while (C.size() > 1 && C.back() == 0) C.pop_back();
	queue<char> ret;
	for (auto e : C) ret.push(e + '0');
	return ret;
}

int strcmpN(const string& n1, const string& n2) {
	if (n1.size() != n2.size())
		return n1.size() > n2.size() ? 1 : -1;
	return strcmp(n1.c_str(), n2.c_str());
}

int main()
{
	string str1, str2;
	while (cin >> str1 >> str2)
	{
		queue<char> q1, q2;
		for (auto it = str1.rbegin(); it != str1.rend(); it++) q1.push(*it);
		for (auto it = str2.rbegin(); it != str2.rend(); it++) q2.push(*it);
		p1(q1); cout << '\n'; p1(q2); cout << "\n\n";
		int j1 = 0, j2 = 0;
		if (str1[0] == '-') {
			str1 = str1.substr(1);
			j1 = 1;
		}
		if (str2[0] == '-') {
			str2 = str2.substr(1);
			j2 = 1;
		}
		//cout << "去了减号：" << str1 << ' ' << str2 << '\n';
		int cmp = strcmpN(str1.c_str(), str2.c_str());
		//cout << 'c' << cmp;
		if (j1 - j2 == 0) {
			if (j1 && j2) cout << '-';
			p1(p2(str1, str2));
		}
		else {
			if (cmp == 0) cout << '0';
			else if (cmp == 1) {
				if (j1) cout << '-';
				p1(p3(str1, str2));
			}
			else {
				if (j2) cout << '-';
				p1(p3(str2, str1));
			}
		}
	}
	return 0;
}